package com.ruoyi.web.controller.agoniappWeb;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.pojo.entity.Facility;
import com.ruoyi.system.service.IAgoniFacilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/pages/facility")
public class FacilityWebController {

    @Autowired
    private IAgoniFacilityService    agoniFacilityService;

    //TODO:设施列表接口
    @GetMapping("/listFacilities")
    public AjaxResult listFacilities() {
        return AjaxResult.success(agoniFacilityService.listFacilities());
    }

    //TODO：添加设施接口
    @PostMapping("/addFacility")
    public AjaxResult addFacility(@RequestBody Facility facility) {
        int result=(agoniFacilityService.addFacility(facility));
        if (result==1){
            return AjaxResult.success("添加设施成功！");
        }

        return AjaxResult.error("添加设施失败！");
    }

}
